import Vue from 'vue'
import Vuex from 'vuex'
// 引入子存储库
import user from './modules/user'
// 引入vuex-persistedstate数据持久化
import createVuexPersisted from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    user
  },
  plugins: [
    createVuexPersisted({
      reducer (val) {
        console.log(val)
        // 指定储存某个模块的数据
        console.log(val)
        return {
          user: val.user
        }
      }
    })
  ]
})
